home *** CD-ROM | disk | FTP | other *** search
/ Ian & Stuart's Australian Mac 1993 September / September 93.iso / Archives / Applications / Calculators / NumberCrunch 1.41 / Number Crunch II Demo / Writing External Codes (xCOD) / Pascal source code / About Pascal sources next >
Encoding:
Text File  |  1992-09-03  |  2.5 KB  |  26 lines  |  [TEXT/NCII]

  1. The files in this folder are sample Pascal sources for NumberCrunch II xCOD (eXternal CODe resource) routines. 
  2.  
  3. Since the resource here were compiled with THINK Pascal,
  4.   © Symantec Corp. 1991
  5.   Certain portions of this software are copywrited by Symantec Corp.
  6.  
  7. After being compiled, the xCOD be installed into NumberCrunch II using ResEdit or by using the Load xCOD command inside NCII. 
  8.  
  9. A string describing the arguments of the subroutine must accompany each xCOD, as described in the comment at the beginning of each sample subroutine.  This string is stored as an sCOD resource with an ID that matches the xCOD resource.  If ResEdit is used to install the xCOD, the sCOD may be created by hand (with the Create New Resource command in ResEdit), or Load xCOD will prompt for the sCOD string in a dialog if it cannot find the right sCOD.
  10.  
  11. Two sample source files, 
  12.    SCHRODINGER.p   and
  13.    SAMPLE_XCOD.p
  14. are included in this folder. SCHRODINGER finds stationary states in a one-dimensional potential, while SAMPLE_XCOD merely demonstrates the the different types and calling mechanisms to use in a Pascal xCOD.  Schrodinger is used in the file by the same name in the Sample Files : Physics folder.
  15.  
  16. Note that
  17.  
  18.  •  ALL variables passed to and from pascal xCODs must be declared VAR, and must EXTENDED, even the array sizes.  Since Pascal requires integer array subscripts, passed array sizes should be converted by an assignment like using the SANE routine Num2Integer, as shown in the .p files.
  19.  
  20.  •  NCII passes other routines by pointer, which is not how Pascal normally passes routines in parameter lists.  Pascal can only use pointers to procedures by the use of an inline kludge, which is shown in SAMPLE_XCOD.  
  21.  
  22.  •  Because of it's strong typing of variables, passing arrays of unkown lengths to and from Pascal routines is awkward.  SAMPLE_XCOD shows an example where a type is declared for an array of a specific length, in order to create an array of the size in the program itself.  Since these local variables are put on the stack, however, rather than in main memory, they cannot be too large.  Although it is possible to allocate space in main memory from inside a Pascal procedure, it is usually easier in these xCOD subroutines to simply created the needed work space in NCII and pass it as a work array to the xCOD.
  23.  
  24. •  The .code (.code2) files contain the compiled code and matching sCOD resouces, which were created in ResEdit.  The ID's have been changed from 42 to a unique number and an "x" has been added to the xCOD names.
  25.  
  26.